package com.tarena.lbs.content.controller;

import com.github.pagehelper.PageInfo;
import com.tarena.lbs.base.protocol.model.Result;
import com.tarena.lbs.base.protocol.pager.PageResult;
import com.tarena.lbs.content.pojo.vo.ArticleCategoryVO;
import com.tarena.lbs.content.pojo.vo.ArticleVO;
import com.tarena.lbs.content.service.CategoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 处理文章分类 业务模块功能
 * @author 周恒宇
 * @date 6/10
 */

@Api(tags = "文章分类管理")
@RestController
@Slf4j
public class CategoryController {
    @Autowired
    private CategoryService categoryService;

    /**
     * 插入分类
     * ~
     * @return
     */
    @ApiOperation("文章分类列表查询")
    @GetMapping("/admin/content/category/list")
    public Result<PageResult<ArticleCategoryVO>> pageList(){
        log.info("查询文章分类列表");
        PageResult <ArticleCategoryVO> result = categoryService.pageList();
        return new Result<>(result);
    }
}
